<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="common_header(title,links)">

    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=no"/>

    <title th:replace="${title}">选课系统</title>

    <link th:href="@{/bootstrap/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/icon/materialdesign/css/materialdesignicons.min.css}" rel="stylesheet">
    <link th:href="@{/css/style.min.css}" rel="stylesheet">

    <th:block th:replace="${links}"/>

</head>

<body>

<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar" th:fragment="sidebar(first,second)">

            <div class="lyear-layout-sidebar-scroll">

                <nav class="sidebar-main">
                    <ul class="nav nav-drawer">
                        <li th:class="${first}=='main'?'nav-item active':'nav-item'">
                            <a th:href="@{/index}"><i class="mdi mdi-home"></i> 首页</a>
                        </li>
                        <li th:class="${first=='choose'?'nav-item nav-item-has-subnav open active':'nav-item nav-item-has-subnav open active'}">
                            <a href="javascript:void(0)"><i class="mdi mdi-book-open-page-variant"></i> 网上选课</a>
                            <ul class="nav nav-subnav">
                                <li th:class="${second=='major'?'active':''}"><a
                                        th:href="@{'/clazz/list'}">必修课课程表</a>
                                </li>
<!--                                直接点击无效-->
                                <li th:class="${second=='bixiu'?'active':''}">
                                    <a onclick="warningForMajor()">必修课授课计划</a>
                                </li>
                                <li th:class="${second=='xuanxiu'?'active':''}"><a
                                        onclick="warningForElective()">选修课授课计划</a></li>
                                <!--<li th:class="${second=='xuanxiu'?'active':''}"><a
                                        th:href="@{'/choose/elective/list'}" onclick="warningForElective()">选修课授课计划</a></li>-->
                            </ul>
                        </li>
                        <li th:class="${first=='info'?'nav-item nav-item-has-subnav open active':'nav-item nav-item-has-subnav open active'}">
                            <a href="javascript:void(0)"><i class="mdi mdi-book-open-page-variant"></i> 信息查询</a>
                            <ul class="nav nav-subnav">
                                <li th:class="${second=='kaoshi'?'active':''}"><a
                                        th:href="@{'/kaoshi/list'}">学生考试查询</a></li>
                                <li th:class="${second=='grade'?'active':''}"><a
                                        th:href="@{'/grade/list'}">学生成绩查询</a></li>
                                <li th:class="${second=='result'?'active':''}"><a
                                        th:href="@{'/result/list'}">学生选课情况查询</a></li>
                            </ul>
                        </li>
                        <li th:class="${first=='teach'?'nav-item nav-item-has-subnav open active':'nav-item nav-item-has-subnav open active'}">
                            <a href="javascript:void(0)"><i class="mdi mdi-book-open-page-variant"></i> 信息维护</a>
                            <ul class="nav nav-subnav">
                                <li th:class="${second=='list'?'active':''}"><a onclick="warningForInfoFix()">个人信息修改</a></li>
                            </ul>
                        </li>
                    </ul>
                </nav>
                <div class="sidebar-footer">
                    <p class="copyright text-center">Copyright © 2021 杭州电子科技大学计算机学院 牧一尔 All Rights Reserved</p>
                </div>

            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header" th:fragment="topbar">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> <h2>杭州电子科技大学在线选课系统</h2> </span>
                    </div>

                    <ul class="topbar-right">
                        <li class="dropdown dropdown-profile">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <!--                                改成从cookie中获取学生姓名-->
                                <span th:id="sno" th:each="cookie :${#httpServletRequest.getCookies()}"
                                      th:if="${cookie.getName().equals('sname')}" th:text="'欢迎您：'+${cookie.getValue()+'同学'}">
                                <span></span> <span class="caret"></span></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li class="divider"></li>
<!--                                <li><a th:href="@{/logout}"><i class="mdi mdi-logout-variant"></i> 退出登录</a></li>-->
                                <li><a onclick="out()"><i class="mdi mdi-logout-variant"></i> 退出登录</a></li>
                            </ul>
                        </li>
                        <!--切换主题配色-->
                        <li class="dropdown dropdown-skin">
                            <span data-toggle="dropdown" class="icon-palette"><i class="mdi mdi-palette"></i></span>
                            <ul class="dropdown-menu dropdown-menu-right" data-stopPropagation="true">
                                <li class="drop-title"><p>主题</p></li>
                                <li class="drop-skin-li clearfix">
                  <span class="inverse">
                    <input type="radio" name="site_theme" value="default" id="site_theme_1" checked>
                    <label for="site_theme_1"></label>
                  </span>
                                    <span>
                    <input type="radio" name="site_theme" value="dark" id="site_theme_2">
                    <label for="site_theme_2"></label>
                  </span>
                                    <span>
                    <input type="radio" name="site_theme" value="translucent" id="site_theme_3">
                    <label for="site_theme_3"></label>
                  </span>
                                </li>
                                <li class="drop-title"><p>头部</p></li>
                                <li class="drop-skin-li clearfix">
                  <span class="inverse">
                    <input type="radio" name="header_bg" value="default" id="header_bg_1" checked>
                    <label for="header_bg_1"></label>
                  </span>
                                    <span>
                    <input type="radio" name="header_bg" value="color_2" id="header_bg_2">
                    <label for="header_bg_2"></label>
                  </span>
                                    <span>
                    <input type="radio" name="header_bg" value="color_3" id="header_bg_3">
                    <label for="header_bg_3"></label>
                  </span>
                                    <span>
                    <input type="radio" name="header_bg" value="color_4" id="header_bg_4">
                    <label for="header_bg_4"></label>
                  </span>
                                    <span>
                    <input type="radio" name="header_bg" value="color_5" id="header_bg_5">
                    <label for="header_bg_5"></label>
                  </span>
                                    <span>
                    <input type="radio" name="header_bg" value="color_6" id="header_bg_6">
                    <label for="header_bg_6"></label>
                  </span>
                                    <span>
                    <input type="radio" name="header_bg" value="color_7" id="header_bg_7">
                    <label for="header_bg_7"></label>
                  </span>
                                    <span>
                    <input type="radio" name="header_bg" value="color_8" id="header_bg_8">
                    <label for="header_bg_8"></label>
                  </span>
                                </li>
                                <li class="drop-title"><p>侧边栏</p></li>
                                <li class="drop-skin-li clearfix">
                  <span class="inverse">
                    <input type="radio" name="sidebar_bg" value="default" id="sidebar_bg_1" checked>
                    <label for="sidebar_bg_1"></label>
                  </span>
                                    <span>
                    <input type="radio" name="sidebar_bg" value="color_2" id="sidebar_bg_2">
                    <label for="sidebar_bg_2"></label>
                  </span>
                                    <span>
                    <input type="radio" name="sidebar_bg" value="color_3" id="sidebar_bg_3">
                    <label for="sidebar_bg_3"></label>
                  </span>
                                    <span>
                    <input type="radio" name="sidebar_bg" value="color_4" id="sidebar_bg_4">
                    <label for="sidebar_bg_4"></label>
                  </span>
                                    <span>
                    <input type="radio" name="sidebar_bg" value="color_5" id="sidebar_bg_5">
                    <label for="sidebar_bg_5"></label>
                  </span>
                                    <span>
                    <input type="radio" name="sidebar_bg" value="color_6" id="sidebar_bg_6">
                    <label for="sidebar_bg_6"></label>
                  </span>
                                    <span>
                    <input type="radio" name="sidebar_bg" value="color_7" id="sidebar_bg_7">
                    <label for="sidebar_bg_7"></label>
                  </span>
                                    <span>
                    <input type="radio" name="sidebar_bg" value="color_8" id="sidebar_bg_8">
                    <label for="sidebar_bg_8"></label>
                  </span>
                                </li>
                            </ul>
                        </li>
                        <!--切换主题配色-->
                    </ul>

                </div>
            </nav>

        </header>
        <!--End 头部信息-->

        <!--End 页面主要内容-->

    </div>
</div>

<div th:fragment="common_js(scripts)">
    <!-- javascript -->
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/perfect-scrollbar.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/main.min.js}"></script>
    <script>

        function warningForInfoFix() {
            alert("暂不支持学生本人修改信息，请联系管理员协助修改！")
        }

        function warningForMajor() {
            alert("必修课授课计划无法直接查看，请从必修课课程表页面进入，查看对应课程授课计划！")
        }

        function warningForElective() {
            alert("请注意：选修课课程余量显示存在1分钟延迟，具体选课结果以【学生选课情况查询】显示为准！");
            location.href = "/choose/elective/list"
        }

        function out(){
            alert("退出登陆成功，将会跳转到登陆页面！");
            window.location.href = "/logout";
        }
    </script>
    <th:block th:replace="${scripts}"/>
</div>

</body>
</html>